#include <stdio.h>
#include <string.h>
#ifndef SOFTWARE_NAME
#define SOFTWARE_NAME "fppartialdischarge"
#endif
#ifndef VERSION
#define VERSION "NO VERSION"
#endif
#include <stdio.h>
#include <stdint.h>
#include <stdio.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include "darknet.h"

int main(int argc, char *argv[])
{
  network *net = load_network("cfg/yolov4.cfg",
      "source/yolov4.weights", 0);
  set_batch_network(net, 1);
  srand(time(0));
  //char *image_path = "obj/test.rgb";
  char *image_path = "obj/dog.jpg";
  image orig = load_image_color(image_path, 0, 0);
  //image sized = resize_image(orig, net->w, net->h);
  image sized = orig;
  float *predictions = network_predict(net, sized.data);
  int i;
  for (i = 0; i < 10; i++) {
    printf("Prediction %d: %f\n", i, predictions[i]);
  }
  // 假设 predictions 是网络预测的结果
  for (i = 0; i < 10; i++) {
    printf("Prediction %d: %f\n", i, predictions[i]);
  }
// 输出更多信息，显示每个检测框的类别和置信度
  for (i = 0; i < net->layers[net->n - 1].n; i++) {
    printf("Object %d: %f\n", i, predictions[i]);
  }

  int nboxes;
  //detection *dets = get_network_boxes(net, sized.w, sized.h,
   //   0.5, 0.5, 0, 1, &nboxes);
  /*
  for (i = 0; i < nboxes; i++) {
    printf("Detected object %d: Class %d, Confidence %f\n",
        i, dets[i].classes[0], dets[i].prob[0]);
  }
  */

  free_image(orig);
  free_image(sized);
  free_network(net);
  return 0;
}

